
# read_bc_matrix: 读取 10x cellranger 结果文件 ----
read_bc_matrix <- function(bc_matrix_path, project, num){
  obj <- bc_matrix_path %>%
    Read10X %>%
    CreateSeuratObject(project = project, min.cells = 5, min.features = 200)
  # new.names <- colnames(obj) %>% 
  #   sapply(function(x){
  #     paste0(strsplit(x,split='-')[[1]][1], paste0('-',num))
  #   }) %>% unname()
  # obj <- RenameCells(obj, new.names = new.names)
  # obj[["percent.mt"]] <- PercentageFeatureSet(obj, pattern = "^MT-")
  # obj <- NormalizeData(obj)
  # obj <- FindVariableFeatures(obj, selection.method = "vst", nfeatures = 2000)
  # obj <- ScaleData(obj)
  return(obj)
}
